<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ezcomp="http://java.sun.com/jsf/composite/ezcomp"> 
    <h:head>
        <title>Stakeholder Points Manager</title>
 
        <style type="text/css"> 

            .gritter-notice-wrapper { 
                left:200px; 
                top:50px; 
            } 
        </style> 
    </h:head>
    
    
    
    <h:body>
        <h1>Stakeholder Account and Billing Management -- Points Management</h1> 

        <p:layout style="table-layout:auto; height:700px ">
            <p:layoutUnit position="left" header="Navigation" width="300">
                <ezcomp:RepSABMLeftMenu/>
            </p:layoutUnit>
            
            
            
            <p:layoutUnit position="center" header="Settings" scrollable="true">
                You currently have <h:outputText value ="#{fakeMainPortalMB.retrieveStakeholderLoyaltyPoints()}"/> loyalty points.
                            
                            <br/>
                            <br/>
                            <br/>               
                            
                
                            <b>Give Loyalty Points</b><br/>
                            <h:form>                   
                                
                            </h:form>  
                            
                            <br/>
                            <br/>
                            <br/>
                            
                            <b>Buy Loyalty Points</b><br/>
                            <h:panelGroup id="selectedChoice">
                                           <h:form>                                                 
                                                <p:dataTable var="selectedRow" value="#{StakeholderPointsMB.purchaseList}"
                                                             rowSelectListener="#{StakeholderPointsMB.updatePurchasePrice()}"
                                                             selection="#{StakeholderPointsMB.selectedPurchaseItem}" selectionMode="single" 
                                                             onRowSelectUpdate="selectedChoice"
                                                             >
                                                     <p:column headerText="Points"> #{selectedRow.quantity}</p:column>          
                                                     <p:column headerText="Price"> #{selectedRow.price}</p:column>  
                                                </p:dataTable>                      
                                            </h:form>    

                                            <br/>
                                            <br/>

                                            <form id="id_PaypalForm" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" 
                                                  style="margin-left:auto;margin-right:auto;">  

                                                 <input type="hidden" name="cmd" value="_xclick"/>  
                                                 <input type="hidden" name="business" value="zhou84_1317112812_biz@gmail.com"/>  
                                                 <input type="hidden" name="item_name"   value="Loyalty Points Purchase"/>  
                                                 <input type="hidden" name="item_number" value="0"/>  
                                                 <input type="hidden" name="amount" value="#{StakeholderPointsMB.selectedPurchaseItem.price}"/>  
                                                 <input type="hidden" name="tax" value="0"/>  
                                                 <input type="hidden" name="quantity" value="1"/>  
                                                 <input type="hidden" name="no_note" value="1"/>  
                                                 <input type="hidden" name="currency_code" value="SGD"/> 
                                                 <input type="hidden" name="return" value="http://localhost:8080/Foodsage-war/BuyPoints_Stakeholder_Complete.xhtml"/> 

                                                <input type="image" name="submit" border="0"
                                                        src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif"  
                                                        alt="PayPal - The safer, easier way to pay online"
                                                />  
                                            </form>  
                            </h:panelGroup>
                           
                            
                            
            </p:layoutUnit>
            
        </p:layout>
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
    </h:body>
</html>

